import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AppuserVO, AppuserForm, AppuserQuery } from '@/api/business/appuser/types';

/**
 * 查询钱包用户列表
 * @param query
 * @returns {*}
 */

export const listAppuser = (query?: AppuserQuery): AxiosPromise<AppuserVO[]> => {
  return request({
    url: '/business/appuser/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询钱包用户详细
 * @param id
 */
export const getAppuser = (id: string | number): AxiosPromise<AppuserVO> => {
  return request({
    url: '/business/appuser/' + id,
    method: 'get'
  });
};

/**
 * 新增钱包用户
 * @param data
 */
export const addAppuser = (data: AppuserForm) => {
  return request({
    url: '/business/appuser',
    method: 'post',
    data: data
  });
};

/**
 * 修改钱包用户
 * @param data
 */
export const updateAppuser = (data: AppuserForm) => {
  return request({
    url: '/business/appuser',
    method: 'put',
    data: data
  });
};

/**
 * 删除钱包用户
 * @param id
 */
export const delAppuser = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/appuser/' + id,
    method: 'delete'
  });
};
